@import './variables.scss';

@mixin colorBtn($color) {
  background: $color;

  &:hover {
    color: $color;

    &:before,
    &:after {
      background: $color;
    }
  }
}

@mixin colorBtn2($backcolor, $hoverColor, $color) {
  background: $backcolor !important;
  color: $color !important;

  &:hover {
    background: $hoverColor !important;
    color: $color !important;
    border-color: $backcolor !important;

    &:before,
    &:after {
      background: $hoverColor !important;
      color: $color !important;
    }
  }
  &:focus {
    background: $hoverColor !important;
    color: $color !important;
  }
}

@mixin colorBtn3($color) {
  color: $color;

  &:hover {
    color: $color;

    &:before,
    &:after {
      color: $color;
    }
  }
  &:focus {
    color: $color;
  }
}

@mixin colorBtn4($backcolor, $color) {
  background: $backcolor !important;
  color: $color !important;

  &:hover {
    background: $backcolor;
    color: $color;

    &:before,
    &:after {
      background: $backcolor;
      color: $color;
    }
  }
  &:focus {
    background: $backcolor;
    color: $color;
  }
}

// HEX 转 RGBA 的函数
@function hexToRgba($hex, $alpha) {
  $r: red($hex);
  $g: green($hex);
  $b: blue($hex);
  @return rgba($r, $g, $b, $alpha);
}

// 自定义按钮颜色
.query-btn:not(.el-button--text):not(.is-disabled) {
  @include colorBtn2($query-btn-color, hexToRgba($query-btn-color, 0.8), $default-btn-color)
}
.reset-btn:not(.el-button--text):not(.is-disabled) {
  @include colorBtn2($reset-btn-color, hexToRgba($reset-btn-color, 0.8), $default-btn-color)
}
.add-btn:not(.el-button--text):not(.is-disabled) {
  @include colorBtn2($add-btn-color, hexToRgba($add-btn-color, 0.8), $default-btn-color)
}
.edit-btn:not(.el-button--text):not(.is-disabled) {
  @include colorBtn2($edit-btn-color, hexToRgba($edit-btn-color, 0.8), $default-btn-color)
}
.del-btn:not(.el-button--text):not(.is-disabled) {
  @include colorBtn2($del-btn-color, hexToRgba($del-btn-color, 0.8), $default-btn-color)
}
.upload-btn:not(.el-button--text):not(.is-disabled) {
  @include colorBtn2($upload-btn-color, hexToRgba($upload-btn-color, 0.8), $default-btn-color)
}
.download-btn:not(.el-button--text):not(.is-disabled) {
  @include colorBtn2($download-btn-color, hexToRgba($download-btn-color, 0.8), $default-btn-color)
}
.expand-btn:not(.el-button--text):not(.is-disabled) {
  @include colorBtn2($expand-btn-color, hexToRgba($expand-btn-color, 0.8), $default-btn-color)
}
.cancel-btn:not(.el-button--text):not(.is-disabled) {
  @include colorBtn2($cancel-btn-color, hexToRgba($cancel-btn-color, 0.8), $default-btn-color)
}
.select-btn:not(.el-button--text):not(.is-disabled) {
  @include colorBtn2($select-btn-color, hexToRgba($select-btn-color, 0.8), $default-btn-color)
}
.config-btn:not(.el-button--text):not(.is-disabled) {
  @include colorBtn2($config-btn-color, hexToRgba($config-btn-color, 0.8), $default-btn-color)
}
.save-btn:not(.el-button--text):not(.is-disabled) {
  @include colorBtn2($save-btn-color, hexToRgba($save-btn-color, 0.8), $default-btn-color)
}
.open-btn:not(.el-button--text):not(.is-disabled) {
  @include colorBtn2($open-btn-color, hexToRgba($open-btn-color, 0.8), $default-btn-color)
}
.show-btn:not(.el-button--text):not(.is-disabled) {
  @include colorBtn2($show-btn-color, hexToRgba($show-btn-color, 0.8), $default-btn-color)
}

.el-button--text.query-btn {
  @include colorBtn3($query-btn-color)
}
.el-button--text.reset-btn {
  @include colorBtn3($reset-btn-color)
}
.el-button--text.add-btn {
  @include colorBtn3($add-btn-color)
}
.el-button--text.edit-btn {
  @include colorBtn3($edit-btn-color)
}
.el-button--text.del-btn {
  @include colorBtn3($del-btn-color)
}
.el-button--text.upload-btn {
  @include colorBtn3($upload-btn-color)
}
.el-button--text.download-btn {
  @include colorBtn3($download-btn-color)
}
.el-button--text.expand-btn {
  @include colorBtn3($expand-btn-color)
}
.el-button--text.cancel-btn {
  @include colorBtn3($cancel-btn-color)
}
.el-button--text.select-btn {
  @include colorBtn3($select-btn-color)
}
.el-button--text.config-btn {
  @include colorBtn3($config-btn-color)
}
.el-button--text.save-btn {
  @include colorBtn3($save-btn-color)
}
.el-button--text.open-btn {
  @include colorBtn3($open-btn-color)
}
.el-button--text.show-btn {
  @include colorBtn3($show-btn-color)
}

.is-disabled.query-btn {
  @include colorBtn4(hexToRgba($query-btn-color, 0.4), $default-btn-color)
}
.is-disabled.reset-btn {
  @include colorBtn4(hexToRgba($reset-btn-color, 0.4), $default-btn-color)
}
.is-disabled.add-btn {
  @include colorBtn4(hexToRgba($add-btn-color, 0.4), $default-btn-color)
}
.is-disabled.edit-btn {
  @include colorBtn4(hexToRgba($edit-btn-color, 0.4), $default-btn-color)
}
.is-disabled.del-btn {
  @include colorBtn4(hexToRgba($del-btn-color, 0.4), $default-btn-color)
}
.is-disabled.upload-btn {
  @include colorBtn4(hexToRgba($upload-btn-color, 0.4), $default-btn-color)
}
.is-disabled.download-btn {
  @include colorBtn4(hexToRgba($download-btn-color, 0.4), $default-btn-color)
}
.is-disabled.expand-btn {
  @include colorBtn4(hexToRgba($expand-btn-color, 0.4), $default-btn-color)
}
.is-disabled.cancel-btn {
  @include colorBtn4(hexToRgba($cancel-btn-color, 0.4), $default-btn-color)
}
.is-disabled.select-btn {
  @include colorBtn4(hexToRgba($select-btn-color, 0.4), $default-btn-color)
}
.is-disabled.config-btn {
  @include colorBtn4(hexToRgba($config-btn-color, 0.4), $default-btn-color)
}
.is-disabled.save-btn {
  @include colorBtn4(hexToRgba($save-btn-color, 0.4), $default-btn-color)
}
.is-disabled.open-btn {
  @include colorBtn4(hexToRgba($open-btn-color, 0.4), $default-btn-color)
}
.is-disabled.show-btn {
  @include colorBtn4(hexToRgba($show-btn-color, 0.4), $default-btn-color)
}


.blue-btn {
  @include colorBtn($blue)
}

.light-blue-btn {
  @include colorBtn($light-blue)
}

.red-btn {
  @include colorBtn($red)
}

.pink-btn {
  @include colorBtn($pink)
}

.green-btn {
  @include colorBtn($green)
}

.tiffany-btn {
  @include colorBtn($tiffany)
}

.yellow-btn {
  @include colorBtn($yellow)
}

.pan-btn {
  font-size: 14px;
  color: #fff;
  padding: 14px 36px;
  border-radius: 8px;
  border: none;
  outline: none;
  transition: 600ms ease all;
  position: relative;
  display: inline-block;

  &:hover {
    background: #fff;

    &:before,
    &:after {
      width: 100%;
      transition: 600ms ease all;
    }
  }

  &:before,
  &:after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    height: 2px;
    width: 0;
    transition: 400ms ease all;
  }

  &::after {
    right: inherit;
    top: inherit;
    left: 0;
    bottom: 0;
  }
}

.custom-button {
  display: inline-block;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  background: #fff;
  color: #fff;
  -webkit-appearance: none;
  text-align: center;
  box-sizing: border-box;
  outline: 0;
  margin: 0;
  padding: 10px 15px;
  font-size: 14px;
  border-radius: 4px;
}
